# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgname=git-warp-time
pkgver=0.4.10
pkgrel=1
pkgdesc='reset timestamps of Git repository files to the time of the last modifying commit'
arch=(loong64 x86_64)
url="https://github.com/alerque/$pkgname"
license=(GPL3)
depends=(gcc-libs
         glibc
         libgit2.so)
makedepends=(cargo
             git
             jq)
_archive="$pkgname-$pkgver"
source=("$url/releases/download/v$pkgver/$_archive.tar.xz")
sha256sums=('6c97f5b78d2b332f1958a82848cbddd007ff7d227cd1cc8fa343f3bd02453e20')

prepare() {
	cd "$_archive"
	sed Makefile.am -i \
		-e 's/cargo \(build\|install\|test\)/cargo --offline \1/'
	autoreconf
	cargo fetch --locked
}

build() {
	cd "$_archive"
	CFLAGS+=" -ffat-lto-objects"
	./configure --prefix /usr --enable-shared
	make
}

check() {
	cd "$_archive"
	make check
}

package() {
	cd "$_archive"
	make DESTDIR="$pkgdir" install
}
